package com.zoweunion.mechanic.dao.app;

import com.zoweunion.mechanic.util.entity.OrderBean;
import com.zoweunion.mechanic.util.entity.OrderCheck;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Component;

import java.util.Date;
import java.util.List;
import java.util.Map;

@Component
public interface OrderDao {

    public int deleteWarehouseLocation(Map<String,Object> reqMap);

    List<Map<String, Object>> getWarehouseLocation(Map<String, Object> reqMap);

    public void savaWarehouseLocation(Map<String, Object> reqMap);

    public String selectAuthValue(@Param("userId") String userId);

    public String selectOrderMoney(@Param("orderId") String orderId);

    public String verifyAuthPassword(@Param("userId") String userId);

    Map<String, Object> selectbyThingsId(@Param("thingsId") String thingsId);

    List<Map<String, Object>> selectByTime(@Param("params") Map<String, Object> params);

    public int updateOrderPirce(Map<String, Object> reqMap);

    public int insertAuthLog(Map<String, Object> reqMap);

    List<Map<String, Object>> getMaintainOrder();

    Map<String, Object> getCarById(@Param("c_id") String c_id);

    List<Map<String, Object>> getCarListAll();

    List<Map<String, Object>> listOrderGEO();

    int updateOrderArea(@Param("areaNumber") String areaNumber, @Param("id") String id);

    List<Map<String, Object>> getOrderList(Map<String, Object> reqMap);

    // 获取工单故障信息
    List<Map<String, Object>> findOrderFaultById(Map<String, Object> reqMap);

    // 获取工单车辆信息
    Map<String, Object> findCarInfoById(Map<String, Object> reqMap);

    // 获取工单详情
    Map<String, Object> getOrderDetail(Map<String, Object> reqMap);

    // 获取修工列表
    List<Map<String, Object>> getRepairList(Map<String, Object> reqMap);

    // 提交听诊工单
    int updateDiagnoseInfo(Map<String, Object> reqMap);

    // 插入工单详情列表
    int createOrderDetail(Map<String, Object> reqMap);

    // 插入工单的修工
    int createRepairman(Map<String, Object> reqMap);

    // 转诊
    int updateChangeDiagnoseInfo(Map<String, Object> reqMap);

    // 修工自检
    int updateRepairCheckStatus(Map<String, Object> reqMap);

    // 修工互检
    List<Map<String, Object>> repairCheckStatus(Map<String, Object> reqMap);

    String getOrderById(@Param("orderId") String orderId);

    int saveOrderDiscount(Map<String, Object> reqMap);

    // 查询修工信息
    List<Map<String,Object>>selectRepairLocationRecord(Map<String, Object> reqMap);

    // 更新修工位置信息
    int updateLocationRecord(Map<String, Object> reqMap);

    // 更新工单详情
    int updateOrderDetail(Map<String, Object> reqMap);

    // 更新工单
    int updateOrderInfo(Map<String, Object> reqMap);


    /**
     * 根据服务商获取今日所有工单信息
     *
     * @return
     */
    List<Map<String, Object>> getAllOrderBySId(@Param("KFTime") Integer KFTime
            , @Param("TZTime") Integer TZTime, @Param("CGTime") Integer CGTime
            , @Param("XGTime") Integer XGTime, @Param("XGArriveTime") Integer XGArriveTime
            , @Param("sId") String sId
    );
    /**
     *
     *
     * @return
     */
    List<Map<String, Object>> getOrderTimeOutList(@Param("KFTime") Integer KFTime
            , @Param("TZTime") Integer TZTime, @Param("CGTime") Integer CGTime
            , @Param("XGTime") Integer XGTime, @Param("XGArriveTime") Integer XGArriveTime
            , @Param("maxCheckTime") Integer maxCheckTime
    );

    String getRepairManByOrderId(@Param("orderId") String orderId, @Param("isMain") Boolean isMain);

    String getRepairManUserNoByOrderId(@Param("orderId") String orderId, @Param("isMain") Boolean isMain);

    String getRepairManUserIdByOrderId(@Param("orderId") String orderId, @Param("isMain") Boolean isMain);

    int creditLimitRepayment(Map<String, Object> reqMap);

    // 工单使用额度详情
    List<Map<String, Object>> getOrderCreditUseList(Map<String, Object> reqMap);

    // 还款的记录
    List<Map<String, Object>> getOrderRepaymentList(Map<String, Object> reqMap);

    // 获取用户还款总额度
    Double getOrderRepaymentSum(Map<String, Object> reqMap);

    // 获取用户使用总额度
    Double getOrderUseSum(Map<String, Object> reqMap);

    Map<String, Object> getMainRepairMan(@Param("orderId") String orderId);

    List<Map<String, Object>> getRepairManList(@Param("orderId") String orderId);

    String getParentId(@Param("orderId") String orderId);

    List<Map<String, Object> > selectPushByOrder();

    List<Map<String, Object> > selectOrderPushLevel(@Param("pushLevel")Integer pushLevel);

    String getFuelGauge(@Param("thingsId") String thingsId);

    List<Map<String, Object>>  selectFuelDetail(@Param("params")Map<String, Object> params);

    int selectInterviewTime(@Param("reqMap") Map<String, Object> reqMap);

    void insertInterviewTime(@Param("reqMap") Map<String, Object> reqMap);

    void insertOrderCheckByKf(@Param("orderCheck") OrderCheck orderCheck);

    List<OrderCheck> selectCheckByOrderId(@Param("orderId") String orderId,
                                    @Param("uId") String uId,
                                    @Param("status") Integer status);

    void deleteCheckByOrderId(@Param("id") String id);

    void updateKfByOrderId(@Param("orderCheck") OrderCheck build);

    void updateKfEndTime(@Param("orderId") String orderId, @Param("id") String id);

    List<OrderCheck> selectKfByOrderId(@Param("build") OrderCheck build);

    void updateKfEndTimeList(@Param("id") Long id, @Param("computing_time") Integer computing_time);

    Integer getComputingTimeById(@Param("id") Long id);

    void insertTzOrderCheck(@Param("orderCheck") OrderCheck orderCheck);

    void updateTzCount(@Param("orderCheck") OrderCheck build);

    void deleteCgResponse(@Param("orderId") String order_id, @Param("uId") String u_cg_id,
                          @Param("status") Integer orderCheckCgPastsResponse);

    void updateTzId(@Param("orderCheck") OrderCheck orderCheck);

    List<OrderBean> selectOrderCheck(@Param("params") Map<String, Object> params);


    List<Map<String, Object>>  selectOrderCheckUser(@Param("roleType")Integer roleType,
                                                    @Param("startTime")Date startTime,
                                                    @Param("endTime")Date endTime,
                                                    @Param("sid")String sid);


    List<Map<String, Object>>  selectUserByRoleId(@Param("roleType")Integer roleType);

    List<Map<String, Object>>  listUserByRoleIdAndSid(@Param("roleType")String roleType,@Param("sId")String sid);

//    void selectByOrderCheck(Integer roleType, String userId, Date startTime, Date endTime);

    List<Map<String, Object>> selectByOrderDate(@Param("userId")String userId,
                                                @Param("item")String item,
                                                @Param("roleType")Integer roleType);

    int selectByOrderKFCount(@Param("userId")String userId, @Param("startTime")Date startTime,
                             @Param("endTime")Date endTime);

    // 获取该用户该日期的工单的订单号
    List<String> selectOrC(@Param("userId")String userId,  @Param("item")String item,
                           @Param("roleType")Integer roleType);

    // 通过order_id和userId获取工单详情
    List<Map<String, Object>> selectOrCe(@Param("userId")String userId,  @Param("item")String item);

    // 通过order_id和userId获取工单详情
    List<Map<String, Object>> selectByOrderNoAndUserId(@Param("userId")String userId,  @Param("orderNo")String orderNo);

    Map<String, Object> selectOrderType(@Param("orderId")String order_id);

    List<Map<String, Object>> selectResponseByKf(@Param("item")String item,@Param("sId")String sId);

    // 按月统计
    List<Map<String, Object>> selectMonthResponseByKf(@Param("item")String item,@Param("sId")String sId);

    List<Map<String, Object>> selectCorrectPer(@Param("item")String item,@Param("sId")String sId);

    // 按月统计
    List<Map<String, Object>> selectMonthCorrectPer(@Param("item")String item,@Param("sId")String sId);

    List<Map<String, Object>> selectPayGroup(@Param("startTime")Date startTime,
                                             @Param("endTime")Date endTime,@Param("sId")String sId);

    int selectPayCount(@Param("startTime")Date startTime,
                       @Param("endTime")Date endTime,@Param("sId")String sId);

    Map<String, Object> selectRepairTime(@Param("item")String item,@Param("sId")String sId);

    Map<String, Object> selectMonthRepairTime(@Param("item")String item,@Param("sId")String sId);

    List<Map<String, Object>> selectRepairTimeR(@Param("item")String item,@Param("sId")String sId);

    List<Map<String, Object>> selectMonthRepairTimeR(@Param("item")String item,@Param("sId")String sId);

    List<Map<String,Object>> selectPartsInCount(@Param("item")String item,@Param("sId")String sId);

    List<Map<String,Object>> selectMonthPartsInCount(@Param("item")String item,@Param("sId")String sId);

    List<Map<String,Object>> selectFaultCount(@Param("startTime")Date startTime,
                                              @Param("endTime")Date endTime,@Param("sId")String sId);

    int isCheckTypeExist(@Param("orderId") String orderId, @Param("userId")String userId, @Param("checkType")int orderType);

    List<Map<String,Object>> selectPerformanceUser();

    List<Map<String,Object>> selectPerformanceCheck(@Param("item")Map<String, Object> item);

    List<Map<String,Object>> selectPerformanceCheckDeploy(@Param("item")Map<String, Object> item);

    void insertCheckPoints(@Param("userId")String user_id,@Param("points") int points);

    Map<String,Object> selectCheckPoints(@Param("userId")String userId);

    List<Map<String,Object>> selectCheckList(@Param("params")Map<String, Object> params);

    Map<String,Object> selectCheckPointsByUser(@Param("userId")String userId);

    int selectDeployPoint(@Param("sid")String sid, @Param("roleType")Integer roleType);

    int selectDeployPointNoSid(@Param("roleType")Integer roleType);
    List<String> getRepairMan(@Param("orderId")String orderId,@Param("checkType")int checkType);

    int getRwStatusByOrderId(String order_id);
}
